home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_6 / HEAD.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  4KB  |  118 lines

  1. /* $Id: head.h,v 1.35 1998/03/18 09:15:40 jj Exp $ */
  2. #ifndef __SPARC_HEAD_H
  3. #define __SPARC_HEAD_H
  4.  
  5. #define KERNBASE        0xf0000000  /* First address the kernel will eventually be */
  6. #define LOAD_ADDR       0x4000      /* prom jumps to us here unless this is elf /boot */
  7. #define SUN4C_SEGSZ     (1 << 18)
  8. #define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2)  /* Used in boot remapping. */
  9. #define INTS_ENAB        0x01           /* entry.S uses this. */
  10.  
  11. #define NCPUS            4              /* Architectural limit of sun4m. */
  12.  
  13. #define SUN4_PROM_VECTOR 0xFFE81000     /* SUN4 PROM needs to be hardwired */
  14.  
  15. #define WRITE_PAUSE      nop; nop; nop; /* Have to do this after %wim/%psr chg */
  16. #define NOP_INSN         0x01000000     /* Used to patch sparc_save_state */
  17.  
  18. /* Here are some trap goodies */
  19.  
  20. /* Generic trap entry. */
  21. #define TRAP_ENTRY(type, label) \
  22.     rd %psr, %l0; b label; rd %wim, %l3; nop;
  23.  
  24. /* Data/text faults. Defaults to sun4c version at boot time. */
  25. #define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 1, %l7;
  26. #define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 0, %l7;
  27. #define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 1, %l7;
  28. #define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b C_LABEL(srmmu_fault); mov 0, %l7;
  29.  
  30. /* This is for traps we should NEVER get. */
  31. #define BAD_TRAP(num) \
  32.         rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3;
  33.  
  34. /* This is for traps when we want just skip the instruction which caused it */
  35. #define SKIP_TRAP(type, name) \
  36.     jmpl %l2, %g0; rett %l2 + 4; nop; nop;
  37.  
  38. /* Notice that for the system calls we pull a trick.  We load up a
  39.  * different pointer to the system call vector table in %l7, but call
  40.  * the same generic system call low-level entry point.  The trap table
  41.  * entry sequences are also HyperSparc pipeline friendly ;-)
  42.  */
  43.  
  44. /* Software trap for Linux system calls. */
  45. #define LINUX_SYSCALL_TRAP \
  46.         sethi %hi(C_LABEL(sys_call_table)), %l7; \
  47.         or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
  48.         b linux_sparc_syscall; \
  49.         rd %psr, %l0;
  50.  
  51. /* Software trap for SunOS4.1.x system calls. */
  52. #define SUNOS_SYSCALL_TRAP \
  53.         rd %psr, %l0; \
  54.         sethi %hi(C_LABEL(sunos_sys_table)), %l7; \
  55.         b linux_sparc_syscall; \
  56.         or %l7, %lo(C_LABEL(sunos_sys_table)), %l7;
  57.  
  58. /* Software trap for Slowaris system calls. */
  59. #define SOLARIS_SYSCALL_TRAP \
  60.         b solaris_syscall; \
  61.         rd %psr, %l0; \
  62.         nop; \
  63.         nop;
  64.  
  65. #define INDIRECT_SOLARIS_SYSCALL(x) \
  66.     mov x, %g1; \
  67.     b solaris_syscall; \
  68.     rd %psr, %l0; \
  69.     nop;
  70.  
  71. #define BREAKPOINT_TRAP \
  72.     b breakpoint_trap; \
  73.     rd %psr,%l0; \
  74.     nop; \
  75.     nop;
  76.  
  77. /* Software trap for Sparc-netbsd system calls. */
  78. #define NETBSD_SYSCALL_TRAP \
  79.         sethi %hi(C_LABEL(sys_call_table)), %l7; \
  80.         or %l7, %lo(C_LABEL(sys_call_table)), %l7; \
  81.         b bsd_syscall; \
  82.         rd %psr, %l0;
  83.  
  84. /* The Get Condition Codes software trap for userland. */
  85. #define GETCC_TRAP \
  86.         b getcc_trap_handler; mov %psr, %l0; nop; nop;
  87.  
  88. /* The Set Condition Codes software trap for userland. */
  89. #define SETCC_TRAP \
  90.         b setcc_trap_handler; mov %psr, %l0; nop; nop;
  91.  
  92. /* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
  93.  * gets handled with another macro.
  94.  */
  95. #define TRAP_ENTRY_INTERRUPT(int_level) \
  96.         mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
  97.  
  98. /* NMI's (Non Maskable Interrupts) are special, you can't keep them
  99.  * from coming in, and basically if you get one, the shows over. ;(
  100.  * On the sun4c they are usually asynchronous memory errors, on the
  101.  * the sun4m they could be either due to mem errors or a software
  102.  * initiated interrupt from the prom/kern on an SMP box saying "I
  103.  * command you to do CPU tricks, read your mailbox for more info."
  104.  */
  105. #define NMI_TRAP \
  106.         rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
  107.  
  108. /* Window overflows/underflows are special and we need to try to be as
  109.  * efficient as possible here....
  110.  */
  111. #define WINDOW_SPILL \
  112.         rd %psr, %l0; rd %wim, %l3; b spill_window_entry; andcc %l0, PSR_PS, %g0;
  113.  
  114. #define WINDOW_FILL \
  115.         rd %psr, %l0; rd %wim, %l3; b fill_window_entry; andcc %l0, PSR_PS, %g0;
  116.  
  117. #endif /* __SPARC_HEAD_H */
  118.